<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>数据流分析图</title>
    <style>
        body {
            margin: 0;
            padding: 20px;
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
            background-color: #f5f5f5;
        }
        .container {
            max-width: 1200px;
            margin: 0 auto;
            background-color: white;
            border-radius: 8px;
            box-shadow: 0 2px 4px rgba(0,0,0,0.1);
            padding: 20px;
        }
        .header {
            text-align: center;
            margin-bottom: 20px;
            padding-bottom: 20px;
            border-bottom: 1px solid #eee;
        }
        .header h1 {
            color: #333;
            margin: 0;
            font-size: 24px;
        }
        .graph-container {
            width: 100%;
            height: 750px;
            border: 1px solid #ddd;
            border-radius: 4px;
            overflow: hidden;
        }
        .legend {
            margin-top: 20px;
            padding: 15px;
            background-color: #f8f9fa;
            border-radius: 4px;
        }
        .legend-item {
            display: inline-block;
            margin-right: 20px;
        }
        .legend-color {
            display: inline-block;
            width: 12px;
            height: 12px;
            margin-right: 5px;
            border-radius: 2px;
        }
        .controls {
            margin-top: 20px;
            padding: 15px;
            background-color: #f8f9fa;
            border-radius: 4px;
        }
        .control-group {
            margin-bottom: 10px;
        }
        .control-group:last-child {
            margin-bottom: 0;
        }
        .control-label {
            display: block;
            margin-bottom: 5px;
            font-weight: 500;
            color: #333;
        }
        .control-input {
            padding: 8px;
            border: 1px solid #ddd;
            border-radius: 4px;
            width: 100%;
            box-sizing: border-box;
        }
        .control-select {
            padding: 8px;
            border: 1px solid #ddd;
            border-radius: 4px;
            width: 100%;
            background-color: white;
        }
        .control-button {
            padding: 8px 16px;
            background-color: #2196F3;
            color: white;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            transition: background-color 0.2s;
        }
        .control-button:hover {
            background-color: #1976D2;
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="header">
            <h1>数据流分析图</h1>
        </div>
        
        <div class="graph-container">
            <!-- GRAPH_PLACEHOLDER -->
        </div>
        
        <div class="legend">
            <div class="legend-item">
                <span class="legend-color" style="background-color: #4CAF50;"></span>
                <span>数据定义</span>
            </div>
            <div class="legend-item">
                <span class="legend-color" style="background-color: #2196F3;"></span>
                <span>数据使用</span>
            </div>
            <div class="legend-item">
                <span class="legend-color" style="background-color: #FF9800;"></span>
                <span>数据修改</span>
            </div>
            <div class="legend-item">
                <span class="legend-color" style="background-color: #F44336;"></span>
                <span>数据删除</span>
            </div>
        </div>
        
        <div class="controls">
            <div class="control-group">
                <label class="control-label">变量过滤</label>
                <input type="text" class="control-input" id="variable-filter" 
                       placeholder="输入变量名称进行过滤">
            </div>
            <div class="control-group">
                <label class="control-label">操作类型</label>
                <select class="control-select" id="operation-type">
                    <option value="all">全部</option>
                    <option value="define">定义</option>
                    <option value="use">使用</option>
                    <option value="modify">修改</option>
                    <option value="delete">删除</option>
                </select>
            </div>
            <div class="control-group">
                <button class="control-button" id="apply-filter">应用过滤</button>
                <button class="control-button" id="reset-filter" 
                        style="background-color: #666;">重置</button>
            </div>
        </div>
    </div>
    
    <script>
        // 过滤功能的实现将由Python生成的网络图JS代码处理
        document.getElementById('apply-filter').addEventListener('click', function() {
            const variableFilter = document.getElementById('variable-filter').value;
            const operationType = document.getElementById('operation-type').value;
            // 触发过滤事件
            window.dispatchEvent(new CustomEvent('applyFilter', {
                detail: {
                    variable: variableFilter,
                    operation: operationType
                }
            }));
        });
        
        document.getElementById('reset-filter').addEventListener('click', function() {
            document.getElementById('variable-filter').value = '';
            document.getElementById('operation-type').value = 'all';
            // 触发重置事件
            window.dispatchEvent(new CustomEvent('resetFilter'));
        });
    </script>
</body>
</html> 